package com.ciaojian.client.policy.factory;

import com.ciaojian.client.policy.impl.product.CouponPackageHandleServiceImpl;
import com.ciaojian.client.policy.impl.product.MemberHandleServiceImpl;
import com.ciaojian.client.policy.impl.product.TimesCardHandleServiceImpl;
import com.ciaojian.core.service.ProductHandleService;

import java.util.HashMap;
import java.util.Map;

/**
 * 产品服务
 *
 * @author oxiny
 */
public class ProductHandleFactory {

    private static final Map<Integer, ProductHandleService> MAP = new HashMap<>();

    static {
        MAP.put(0, new MemberHandleServiceImpl());
        MAP.put(1, new TimesCardHandleServiceImpl());
        MAP.put(2, new MemberHandleServiceImpl());
        MAP.put(3, new CouponPackageHandleServiceImpl());
    }

    /**
     * 根据key来获取对应的实现类
     *
     * @param productType 产品类型
     * @return 对应的处理实现
     */
    public static ProductHandleService getMedalService(Integer productType) {
        return MAP.get(productType);
    }
}
